<?php
	if(!defined("IN_APP"))
	{
		exit;
	}
	
	if(!adminpermission('C','120000'))
	{
		echo '无权查看!';
		exit;
	}
	$parm = requestArrayParm($_REQUEST);
	
	if($parm['m'] == 'list')
	{
		unset($wheres,$pages,$sorts,$list);
		if($parm['phone'])
		{
			$wheres['loginname'] = $parm['phone'];
		}
		
		if($parm['name'])
		{
			$wheres['name'] = $parm['name'];
		}
		$wheres['time'] = time();
		
		$pages['rows'] = 20;
		$page = $pages['page'] = getParam('page','get',1);
		
		$resData = _SqlTool::getZijinList($wheres,$pages);
		
		foreach ($resData['list'] as $key => $v)
		{
			$list[] = $v;
		}
		
		if(!empty($parm['daochu']))
		{
			require_once(ROOTDIR.'source/service/class.excel.php');
			unset($row,$data); 
			$i=1;
			$row[$i]['A1'] = '手机号';
			$row[$i]['B1'] = '姓名';
			$row[$i]['C1'] = '返利余额(元)';
			$row[$i]['D1'] = '注册时间';
			$data['row'] = $row;
			$i=2;
			$resData1 = _SqlTool::getZijinList($wheres);	
			foreach ($resData1['list'] as $key => $one)
			{
				$data['row'][$i]['A'.$i] = $one['loginname'];
				$data['row'][$i]['B'.$i] = $one['name'];
				$data['row'][$i]['C'.$i] = $one['sum'];
				$data['row'][$i]['D'.$i] = date('Y-m-d H:i:s',$one['regtime']);
				$i++;
			}
			
			$data['title'] = '沉淀资金统计';
			ExcelToArrary::push($data,'沉淀资金统计导出_'.date('YmdHis'),'F');
		}


		unset($wheres);
		$wheres['addtime'] = array('<=',time());
		$zye = _SqlTool::getSum('jyinfo', $wheres,array(),'money');
		
		
		$pageurl = SITE_URL.'index.php?'.set_URL_Param(get_URL_Param());
	
		$pagetotal = $resData["pages"];
		
		include renderTemplate('caiwu/zjlist');
	}
	